<link href="${rc.getContextPath()}/manage/css/dwzCustomCss/dwz.custom.css?v=${ver}" rel="stylesheet" type="text/css">
<style type="text/css">
#personnelConfirm span.error {
      position: absolute !important;
      left: 148px;
}
#personnelConfirm tr td div {
  height: 26px;
  padding-top: 3px;
}
#personnelConfirm tr td div input{
    float: left;
}
</style>
<form method="post" action="${rc.getContextPath()}/manage/personnelConfirm/saveBatchPersonnelConfirm" class="pageForm required-validate" onsubmit="return validateCallback(this,batchjobAjaxDone);">
    <input type="hidden" name="navTabId" value="${navTabId!''}" />
    <input type="hidden" id="personnel" name="personnel" value="${personnel!''}">
    <div class="pageFormContent">
        <fieldset>
        	<dl class="notnormal">
                <dt><@label key='materialCode.C'>物料编码：</@label></dt>
                <dd>
                    <input class="required look" id="materialLookup.materialCode" name="materialCode" type="text" postField="materialCode" suggestFields="materialCode,materialText" 
                    suggestUrl="${rc.getContextPath()}/manage/material/componentSuggest" lookupGroup="materialLookup" remote="${rc.getContextPath()}/manage/material/validateMaterial" warn="<@label key='materialCodeNotExists.M'>物料编号不存在</@label>"/>
                    <a class="btnLook" href="${rc.getContextPath()}/manage/material/componentLookUp?lookupType=radio" rel="materialLookup_dialog" title="<@label key='select.C,materialCode.C'>选择物料</@label>" lookupGroup="materialLookup" ></a>
                </dd>
            </dl>
            <!-- <dl>
                <dt><@label key='materialText.C'>物料描述：</@label></dt>
                <dd><input type="text" readonly id="materialLookup.materialText" name="materialText" /></dd>
            </dl> -->
            <dl>
                <dt><@label key='quantity.C,colon'>数量</@label></dt>
                <dd><input type="text" name="quantity" class="required number" min="1" maxlength="15"/></dd>
            </dl>
            <dl class="notnormal">
                    <dt><@label key='confirmTime.C,colon'>报工时间：</@label></label></dt>
                    <dd>
                        <input type="text" class="required date"  name="confirmDatetime" readonly  dateFmt="yyyy-MM-dd HH:mm:ss"/><a class="inputDateButton" href="javascript:;">选择</a>
                    </dd>
                </dl>
            
            <dl class="notnormal">
                <dt><@label key="shiftingWorkCenter.C">实际工作中心：</@label></dt>
                <dd>
                <input id="shiftingWorkCenterGrp.workCenterCode" class="required" name="shiftingWorkCenterCode" 
                	type="text"  suggestFields="workCenterCode,workCenterText" postField="workCenterCode" 
					suggestUrl="${rc.getContextPath()}/manage/workCenter/workCenterSuggest" 
					remote="${rc.getContextPath()}/manage/workCenter/validateWorkCenter" 
					lookupGroup="shiftingWorkCenterGrp" autocomplete="off"  value="${personnelConfirm.workCentertext!''}"/>	
                </dd>
            </dl>
            
            
            <dl>
                    <dt><@label key='memo.C,colon'>备注</@label></dt>
                    <dd><input type="text" name="memo"  maxlength="200" /></dd>
            </dl>
        </fieldset>
    </div>
<div class="panelBar">
    <ul class="toolBar">
   		<input id="PCode" name="personnelLookup.personnelCode" type="hidden" type="text" />
   		<input id="PName" name="personnelLookup.personnelName" type="hidden" type="text" />
        <li>
        	<a class="add" lookupGroup="personnelLookup" href="${rc.getContextPath()}/manage/personnel/personnelLookUp?lookupType=multi&navTabId=${navTabId!''}" rel="personnel_dialog" callback="personnel_callback"   title="<@label key='select.C,personnelCode.C'>选择人员</@label>" >
        		<span><@label key="add.B">新增</@label></span>
        	</a>
        </li>
        <li><a href="javascript:" class="delete" onclick="Personneldel()"><span><@label key="delete.B">删除</@label></span> </a>
        </li>
    </ul>
</div>

<table class="table border" width="650px"  layoutH="210" style="border-top-style: none;">
     <thead>
         <tr>
             <th width="27"><input type="checkbox" group="ids" class="checkboxCtrl"></th>
             <th width="52"><@label key="serialNumber.C">序号</@label></th>
             <th width="101"><@label key='personnelCode.C'>人员编号</@label></th>
             <th width="100"><@label key='personnelName.C'>姓名</@label></th>
             
         </tr>
     </thead>
     <tbody id="personnelConfirm">
     </tbody>
	</table>
<div class="formBar">
    <ul>
        <li><div class="buttonActive"><div class="buttonContent"><button onclick="c()" type="submit"><@label key="save.B">保存</@label></button></div></div></li>
        <li>
            <div class="buttonActiveGrey"><div class="buttonContent"><button type="button" class="close"><@label key="cancel.B">取消</@label></button></div></div>
        </li>
    </ul>
</div>
</form>
<script type="text/javascript">
//var personnelConfirmBatchDialog = $.pdialog.getCurrent();
var $p=$.pdialog.getCurrent();
var index =0;
	function personnel_callback() {
        var id = $("#PCode").val();
        var name = $("#PName").val();
        var idArr = new Array();
        var nameArr = new Array();
        idArr = id.split(',');
        nameArr = name.split(',');
        var ht = "";
        for ( var i = 0; i < idArr.length; i++) {
            var orgid = idArr[i];
            var orgname = nameArr[i];
            var my_element = $("#personnel_" + orgid.trim(),$p);
            console.log($p);
            if (my_element.length == 0) {
                ht += "<tr id='personnel_"+orgid+"' target='personnel_code' rel='"+orgid+"'><td width='20'><input  name='ids' value='"+orgid+"' type='checkbox'></td><td width='50'>"
		                + (index+1)
		                + "</td><td width='100'>"
		                + orgid
                        + "</td><td width='100'>"
                        + orgname
                        + "</td></tr>";
                index++;
            }
        }
        $("#personnelConfirm").append(ht);
    }
	function c() {
		var personnel = "";
		var pctable = $("#personnelConfirm");
		pctable.find("tr").each(function(i, n) {
	        var obj = $(n)
	        personnel += obj.attr("id").replace("personnel_", "") + ",";
	    });
		if (personnel.length >= 1) {
			personnel = personnel.substring(0, personnel.length - 1);
	    }
		$("#personnel").val(personnel);
	}
	function Personneldel() {
        var count=0;
        $('input[name="ids"]:checked').each(function(i, e) {
             count++;
         });
        if(count==0)
            {
            alertMsg.warn('<@label key="selectPersonnel.M">请勾选人员！</@label>')
            }
        else
            {
			    alertMsg.confirm("<@label key="delPersonnel.M">确定删除选中人员？</@label>", {
			        okCall : function() {
			            $('input[name="ids"]:checked').each(function(i, e) {
			                $("#personnel_" + e.value).remove();
			            });
			        }
			    });
            }
 	}
</script>